from socket import *


tcp_socket = socket()
tcp_socket.connect(("127.0.0.1", 8888))

fr = open("/home/u/Html/file/4.jpg", "rb")
while True:
    data = fr.read(1024)
    if not data:
        break
    tcp_socket.send(data)
fr.close()

tcp_socket.close()
